home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 15
/
015.d81
/
comal tutor #3
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
18KB
|
453 lines
8 pokev+33,1:q$=chr$(34):vt$="":dimvt$(25)
9 fori=.to25:vt$(i)=left$(vt$,i+1):next:vt$=""
10 r=53265:c=128:v=53248:s=v+1024:li=52016:wi=51200:cl=51203:su=51206:sd=51209
12 pokes+23,.:pokes+4,128
15 gosub1000:print" [215]elcome to this third installment"
16 print"of [204]oadstar's [195][207][205][193][204][160]0.14 [212]utorial. [201]n
17 [153]"the first installment, you entered and
18 print"ran a short [195][207][205][193][204][160]program to convert
19 [153]"degrees ascarenheit into degrees lenelsius
20 print"and in the second you learned how it
21 [153]"worked. (NULL)ow, we will learn some new
22 print"[195][207][205][193][204][160]commands that will let us store"
23 print"our programs onto our disk drives and"
24 print"recall them back into our [195]64's "
25 print"memory.":s%=-1:gosub1200
26 print" [215]e want to make sure our program is
27 [153]"just as we left it. (NULL)right$(NULL)(NULL)closethe program
28 print"to be sure it is still there:
30 [141]1160:[141]1300:x%[178].:y%[178]16:a$[178]"(NULL)right$(NULL)(NULL)":[141]1600
31 [139]e[167]a$[178][202](a$,e):e[178].:[141]1605:[137]31
32 x%[178]4:y%[178]16:[141]1500:[139]k$[179][177][199](13)[167]32
33 [153]:[153]"0010 right$(NULL)(NULL)(NULL)(NULL) "q$"str$valchr$(NULL)valval(NULL) asc? "q$": ascatn(NULL)val(NULL)left$valright$(NULL)
34 print"0020 [195][197][204][211][201][213][211]:=([198][193][210][197][206][200][197][201][212]-32)*(5/9)
35 [153]"0030 (NULL)(NULL)right$(NULL)(NULL) ascatn(NULL)val(NULL)left$valright$(NULL);"q$"asc ="q$";lenval(NULL)(NULL)right$(NULL)(NULL);"q$"len"q$"":[141]1035
36 [141]1150:[153]"stop (NULL)ep, still there! mid$ust for "
37 [153]"practice, (NULL)(NULL)(NULL)closethe program and find out"
38 [153]"how many degrees lenelsius 100 degrees "
39 [153]"ascarenheit converts into:
40 gosub1160:x%=.:y%=21:a$="[210][213][206]":gosub1600
41 ifethena$=mid$(a$,e):e=.:gosub1605:goto41
42 x%=3:y%=21:gosub1500:ifk$<>chr$(13)then42
43 print:print"[196][197][199][210][197][197][211] [198]? ";:
45 x%=11:y%=22:a$="100":gosub1600
46 ifethena$=mid$(a$,e):e=.:gosub1605:goto46
47 x%=14:y%=22
48 gosub1500:ifk$<>chr$(13)then48
49 print:print"100 [198] = 37.7777778 [195]":gosub1700:print"[197][206][196][160][193][212][160]0030";:gosub1700:gosub1700
50 gosub1035:gosub1150:print"[144][146] [217]ep! [201]t's been getting around
51 [153]"37.7777778 len down here in (NULL)ousiana.":[141]1205
55 [153]" (NULL)ow right$'m sure you have turned your
56 print"computer off a time or two since we
57 [153]"'wrote' this program 2 months ago! right$n
58 print"real life, our program would be gone
59 [153]"since turning off the computer erases
60 print"it's memory!
61 [153]" (NULL)e need a way to keep our programs,
62 print"even when we turn our computer off.
63 [153]"(NULL)hat, of course, is why you spent a
64 print"couple of hundred dollars or so on
65 [153]"that disk drive you've got!":[141]1200
70 :
71 :
72 :
73 :
74 :
75 :
76 :
77 :
78 :
79 :
80 [153]" ascirst off, you need to know a few
81 print"things. [193] single floppy disk can hold
82 [153]"144 'files' or 168,656 'bytes' of "
83 [153]"data, whichever comes first. atn 'byte'
84 print"is equivalent to a character: i.e. a
85 [153]"letter, digit, symbol, etc. atn 'file'
86 print"is a set of bytes grouped together and
87 [153]"given a name. atn file can be a peekatn(NULL)right$len,
88 print"[195][207][205][193][204][160]or [205]achine [204]anguage program, or
89 [153]"a graphics picture, a set of sprite
90 print"shapes, a list of names and phone "
91 print"numbers, or any other set of data.":gosub1200
95 print" [194]efore a disk can be used to hold
96 [153]"files, it must be 'formatted'. (NULL)his
97 print"usually only needs to be done once.
98 [153]"atnmong other things, the formatting
99 print"process gives the disk a 'name' and an
100 [153]"'right$.str$.'. (NULL)he right$.str$. is two characters,
101 print"cannot contain a ,[146] or =[146], and must
102 [153]"be different for each disk you own.
103 print"[212]he disk name (and file names, too)
104 [153]"may be up to 16 characters long with
105 print"no ,[146], =[146], ?[146], or *[146], and may not
106 [153]"begin with a #wait or a $wait!":[141]1200
110 [153]" ascormatting a disk is accomplished
111 print"by the disk drive itself, not the [195]64!
112 [153]"right$n other words, you simply (NULL)atn(NULL)(NULL) a "
113 [153]"command to the disk drive, and it does
114 print"the work! [201]n [194][193][211][201][195], this is a tedious
115 [153]"and involved process. right$n len(NULL)(NULL)atn(NULL), the
116 print"[208][193][211][211] statement makes it easy! [202]ust
117 [153]"think of (NULL)atn(NULL)(NULL) as a (NULL)(NULL)right$(NULL)(NULL) to the disk
118 print"drive's 'command channel'. [193]ny disk
119 [153]"drive command can be (NULL)atn(NULL)(NULL)ed!
120 :
121 gosub1200
125 print" [217]our disk drive's manual tells you
126 [153]"that to format a disk, the 'command
127 print"channel' must be given a [206][197][215] command.
128 [153]"(NULL)ike all disk drive 'command channel'
129 print"commands, this one begins with a "
130 print"single letter (in this case, [206] for"
131 print"[206][197][215]), followed by an optional drive"
132 print"number (either none or 0 unless you"
133 print"have a dual-drive unit), plus a :[146],"
134 print"followed by parameters. [212]he "
135 print"parameters for the [206][197][215] command are"
136 print"the [206][193][205][197] and [201][196] for the new disk.":gosub1200
140 print" [211]o, a [206][197][215][160]command to give our disk
141 [153]"the name 'len(NULL)(NULL)atn(NULL)close(NULL)(NULL)(NULL)chr$(NULL)atn(NULL)(NULL)#1' and an right$str$"
142 [153]"of 'len1', would be:"
143 [153]" '(NULL)0:len(NULL)(NULL)atn(NULL)close(NULL)(NULL)(NULL)chr$(NULL)atn(NULL)(NULL)#1,len1'.
144 :
145 :
146 :
147 :
148 print" [211]o how do we get this command to
149 [153]"the disk drive's 'command channel'?
150 print"[215]ith [195][207][205][193][204]'s [208][193][211][211] statement!":gosub1200
155 print" [215]e simply type '[208][193][211][211]', followed by
156 [153]"the command enclosed within double-
157 print"quotes. [206]ow type:"
158 print" [208][193][211][211] "q$"[206]0:[195][207][205][193][204][160][208][210][207][199][210][193][205][211]#1,[195]1"q$"
159 [153]" (str$on't worry..we're (NULL)(NULL)(NULL) going to ":[153]" (NULL)val(NULL)closeyour disk!)
160 gosub1160:gosub1300:x%=.:y%=24:a$="[208][193][211][211] "+q$+"[206]0:[195][207][205][193][204] [208][210][207][199][210][193][205][211]#1,[195]1"+q$:gosub1600
161 ifethena$=mid$(a$,e):e=.:gosub1605:goto161
162 x%=29:y%=24:gosub1500:ifk$<>chr$(13)then162
163 gosub1700:gosub1700
165 gosub1035:gosub1150:gosub1220:print"[144][146][196]one! [206]ow check status by typing:"
166 print" [211][212][193][212][213][211]
170 [141]1160:x%[178].:y%[178]24:a$[178]"(NULL)(NULL)atn(NULL)(NULL)(NULL)":[141]1600
171 [139]e[167]a$[178][202](a$,e):e[178].:[141]1605:[137]171
172 x%[178]6:y%[178]24:[141]1500:[139]k$[179][177][199](13)[167]172
173 [141]1700:[153]"00, (NULL)(NULL),00,00";:[141]1700:[141]1700
175 [141]1035:[141]1150:[153]"stopwait(NULL)ure looks '(NULL)(NULL)' to me!":[141]1205
180 [153]" atnfter formatting a disk, we need"
181 [153]"not do so again. (NULL)e can save up to"
182 [153]"144 programs on it!"
183 :
184 [153]" (NULL)o save the current len(NULL)(NULL)atn(NULL) program
185 print"in memory as a disk file, use [195][207][205][193][204]'s
186 [153]"'(NULL)atn(NULL)val' command. (NULL)e simply type '(NULL)atn(NULL)val'
187 print"followed by our desired file name "
188 print"enclosed in double-quotes! [210]emember,"
189 print"a file name, like a disk name, may be"
190 print"up to 16 characters long.":gosub1200
195 print" [211]ince file names may not contain"
196 print"a ,[146], =[146], ?[146], or *[146], and may not"
197 print"begin with a #[146] or $[146], let's call"
198 print"our program '[195].[195][197][204][